package me.tuyou.rmi.java.service.impl;

import me.tuyou.rmi.java.service.MyService;

import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

/**
 * @Description
 * @Author tuyou_cd
 * @Date 2020/6/19 15:31
 */
public class MyServiceImpl extends UnicastRemoteObject implements MyService {

    private int count = 0;

    public MyServiceImpl() throws RemoteException {

    }

    @Override
    public int add(int a, int b) throws RemoteException {
        System.out.println(++count + "次调用");
        return a + b;
    }

    @Override
    public int sub(int a, int b) throws RemoteException {
        System.out.println(++count + "次调用");
        return  a - b;
    }
}
